package com.ming.reggie.mapper;

import com.ming.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EmployeeMapper {

    /**
     * 根据账号查询员工
     * @param employee
     * @return
     */
    @Select("select * from employee where username = #{username};")
    Employee login(Employee employee);

    /**
     * 插入一条员工信息
     * @param employee
     * @return
     */
    @Insert("insert into employee values(null,#{name},#{username},#{password},#{phone},#{sex}," +
            "#{idNumber},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser});")
    Integer Insert(Employee employee);


    List<Employee> findByPage(@Param("name") String name);

    /**
     * 通过id查询信息
     * @param id
     * @return
     */
    @Select("select * from employee where id = #{id} ;")
    Employee findById(Long id);

    /**
     * 更新员工信息
     * @param employee
     * @return
     */
    Integer update(Employee employee);
}
